<?php
/**
 * Created by PhpStorm.
 * User: chang
 * Date: 16/3/25
 * Time: 下午3:39
 */

namespace Common\Util;


class PageWrap
{
    public static function wrap($data,$count,$page=1,$limit=10)
    {
        $last_page = ceil($count/$limit);

        if($page>$last_page) {
            $page=$last_page;
        }

        return ['page_data'=>$data, 'total_count'=>$count, 'current_page' => $page,'last_page'=>$last_page];
    }
}